#include <iostream>

#include "Implement_bai7_05.h"

using namespace std;

Dyn_Student::Dyn_Student(){
	mssv = 0;
	diemArr = NULL;
	diemNums = 0;
}

Dyn_Student::Dyn_Student(int N){
	diemNums = N;
	diemArr = new float[diemNums];
}

Dyn_Student::Dyn_Student(const Dyn_Student& stu){
	mssv = stu.mssv+2;
	diemNums = stu.diemNums;
	for(int i = 0; i < stu.diemNums; i++){
		diemArr[i] = stu.diemArr[i];
	}
}

void Dyn_Student::nhapMssv(){
	cout<<"Nhap MSSV : "; cin>>mssv;
}

void Dyn_Student::nhapCacDiemSo(){
	for(int i = 0; i < diemNums; i++){
		cout<<"Nhap diem thu "<<i+1<<" : "; cin>>diemArr[i];
	}
}

float Dyn_Student::diemTrungBinh(){
	float sum = 0;
	for(int i = 0; i < diemNums; i++)
		sum += diemArr[i];
	return sum/diemNums;
}

void Dyn_Student::showMssvDiemTB(){
	cout<<"MSSV   : "<<mssv<<endl;
	cout<<"Diem TB: "<<diemTrungBinh()<<endl;
}

Dyn_Student::~Dyn_Student(){
	delete []diemArr;
}
